package com.wholesale.datas;

import java.io.Serializable;

import android.os.Message;

import com.paypal.android.MEP.PayPalResultDelegate;
import com.wholesale.PaypalLayout;

public class PaypalPanelResultDelegate implements PayPalResultDelegate,
		Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6940530964745932846L;

	/**
	 * Notification that the payment has been completed successfully.
	 * 
	 * @param payKey
	 *            the pay key for the payment
	 * @param paymentStatus
	 *            the status of the transaction
	 */
	public void onPaymentSucceeded(String payKey, String paymentStatus) {
		Message msg = new Message();
		msg.what = 2007;
		msg.arg1 = 0;
		msg.obj = payKey;
		PaypalLayout.paypalHandler.sendMessage(msg);
	}

	/**
	 * Notification that the payment has failed.
	 * 
	 * @param paymentStatus
	 *            the status of the transaction
	 * @param correlationID
	 *            the correlationID for the transaction failure
	 * @param payKey
	 *            the pay key for the payment
	 * @param errorID
	 *            the ID of the error that occurred
	 * @param errorMessage
	 *            the error message for the error that occurred
	 */
	public void onPaymentFailed(String paymentStatus, String correlationID,
			String payKey, String errorID, String errorMessage) {
		Message msg = new Message();
		msg.what = 2007;
		msg.arg1 = 1;
		msg.obj = errorMessage;
		PaypalLayout.paypalHandler.sendMessage(msg);
	}

	/**
	 * Notification that the payment was canceled.
	 * 
	 * @param paymentStatus
	 *            the status of the transaction
	 */
	public void onPaymentCanceled(String paymentStatus) {
		Message msg = new Message();
		msg.what = 2007;
		msg.arg1 = 2;
		PaypalLayout.paypalHandler.sendMessage(msg);
	}

}
